home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 6 / coreaids.zip / POPALL.ASM < prev    next >
Assembly Source File  |  1987-06-25  |  1KB  |  57 lines

  1. ;    DESC:    Pop all registers (SI,DI,BP,ES,DS,DX,CX,BX,AX)       V1.00
  2. ;    SAMPLE:    POPALL
  3. ;    ##################################################################
  4.  
  5. PSH_POPS    Segment Para Common 'DATA'
  6.     DW    180 DUP(0)
  7. PSH_POPS    Ends
  8.  
  9.  
  10. POPALLC    Segment
  11.     Assume CS:POPALLC,DS:NOTHING,ES:PSH_POPS
  12.     Public    POPALL
  13.  
  14.                         ;notice.
  15.     DB    'POPALL   - V1.00, Copyright 1987, CoreTechs   ',0DH,0AH
  16.  
  17. POPALL    Proc    Near
  18.  
  19.     Pop    AX                ;save return address.
  20.     Push    AX                ;store mutliple returns.
  21.     Push    AX
  22.  
  23.     Mov    CS:WORD PTR[0],SP        ;move to temporary stack
  24.     Mov    CS:WORD PTR[2],SS        ;where last pushall occurred.
  25.     Mov    SP,PSH_POPS
  26.     Mov    SS,SP
  27.  
  28.     Mov    SP,CS:WORD PTR[6]        ;recover top of stack pointer.
  29.  
  30.     Pop    SI                ;recover register values.
  31.     Pop    DI
  32.     Pop    BP
  33.     Pop    ES
  34.     Pop    DS
  35.     Pop    DX
  36.     Pop    CX
  37.     Pop    BX
  38.     Pop    AX
  39.  
  40.     Pop    CS:WORD PTR[4]            ;recover main return address.
  41.  
  42.     Mov    CS:WORD PTR[6],SP        ;update top of stack pointer.
  43.  
  44.     Mov    SP,CS:WORD PTR[0]        ;return to old stack.
  45.     Mov    SS,CS:WORD PTR[2]
  46.  
  47.     Pop    CS:WORD PTR[8]            ;unload junk from stack.
  48.     Pop    CS:WORD PTR[8]
  49.  
  50.     Push    CS:WORD PTR[4]            ;return to caller and then
  51.     Push    CS:WORD PTR[8]            ;to main routine.
  52.     Ret
  53. POPALL    Endp
  54.  
  55. POPALLC    Ends
  56.     End
  57.